package com.shan.pay.dao;

import com.shan.common.util.MybatisGeneratorUtil;
import com.shan.common.util.PropertiesFileUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * Author: shanzheng <br/>
 * Description: pay项目代码生成类<br/>
 * Date： 17:12 2017/8/25.<br/>
 * Modified By: <br/>
 */
public class Generator {

    // 根据命名规范，只修改此常量值即可
    private static String MODULE = "shan-pay";
    private static String DATABASE = "zheng";
    private static String TABLE_PREFIX = "pay_";
    private static String PACKAGE_NAME = "com.shan.pay";
    private static String JDBC_DRIVER = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.driver");
    private static String JDBC_URL = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.url");
    private static String JDBC_USERNAME = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.username");
    private static String JDBC_PASSWORD = PropertiesFileUtil.getInstance("generator").get("generator.jdbc.password");

    // 需要insert后返回主键的表配置，key:表名,value:主键名
    private static Map<String, String> LAST_INSERT_ID_TABLES = new HashMap<String, String>();

    static {

    }

    /**
     * Description: 自动代码生成
     *
     * @param args
     * @author: shanzheng
     * @date: 18:10 2017/8/25
     * @return: void
     */
    public static void main(String[] args) throws Exception {
        MybatisGeneratorUtil.generator(JDBC_DRIVER, JDBC_URL
                , JDBC_USERNAME, JDBC_PASSWORD, MODULE, DATABASE, TABLE_PREFIX, PACKAGE_NAME, LAST_INSERT_ID_TABLES);
    }

}
